package com.kotle.mvvmdesign.simpledemo;

import com.kotle.baselib.mvvm.BaseNetWork;
import com.kotle.baselib.mvvm.NetCallBack;
import com.kotle.baselib.retfofit.NetRequestCall;
import com.kotle.mvvmdesign.net.NetApi;
import com.kotle.mvvmdesign.net.NetHelper;

import java.util.List;

import io.reactivex.Observable;

/**
 * Created by Kotle on 2017/10/31.
 */

public class MainNetWork extends BaseNetWork {
    final static int NET_WORK_JOK_LIST=0;
    void getJokList(final NetCallBack<List<JokBean>> netCallBack) {
        NetHelper.sendRequest(new NetRequestCall<List<JokBean>, NetApi>() {
            @Override
            protected Observable<List<JokBean>> getObservable(NetApi netApi) {
                return netApi.jokList();
            }

            @Override
            protected void onNext(List<JokBean> jokBean) {
                netCallBack.success(jokBean);
            }

            @Override
            protected void onError(Throwable e) {
                super.onError(e);
            }

            @Override
            protected String getBaseUrl() {
                return "http://api.laifudao.com";
            }
        });
    }
}
